﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcContrib.Pagination;
using Web.App.Infrastructure.Localization.Contract;
using Webshop20.Application.DataTransferObjects;
using Webshop20.Application.Queries.Messages;
using Webshop20.Application.Queries.Services;
using Webshop20.Presentation;

namespace Webshop20.Interface.MVC.Controllers
{
    public class CatalogController : Controller
    {
        private IGetProductsService getProductsService;
        private ILocalisationService localisationService;

        public CatalogController(IGetProductsService getProductsService, ILocalisationService localisationService)
        {
            this.getProductsService = getProductsService;
            this.localisationService = localisationService;
        }

        public ActionResult Index()
        {
            // Add action logic here
            throw new NotImplementedException();
        }

        public ActionResult Categories(GetProductsRequest request)
        {
            var response = (GetProductsResponse)getProductsService.Handle(request);
            return View(new ProductsByCategory(localisationService, response.ProductsPaged, request.CategoryId.ToString(), string.Empty));
        }

        public ActionResult Search(string searchTerm)
        {
            throw new NotImplementedException();
        }

        public ActionResult Product(int productId)
        {
            throw new NotImplementedException();
        }

    }
}
